<h1>Tags</h1>

<p>Tags are a way to put dynamic content into your theme layouts and partials. They represent functions or variables that are made available via plugins. Tags can also accept attributes that affect their output.</p>

<h2>Tag Syntax</h2>

<p>Tags are surrounded by curly braces and start with "pyro", followed by the module, plugin, or widget you are accessing, and the specific variable or function. Each of these is separated by a colon. For example:</p>

<pre class="tags">{pyro:settings:site_name}</pre>

<p>The above will be replaced by the site name from your site settings. This usage is most basic of PyroCMS tags.</p>

<h2>Tag Parameters</h2>

<p>Tags can be modified via parameters that are included after the tag definition. They follow a simple parameter="value" syntax. For example:</p>

<pre class="tags">{pyro:template:partial name="sidebar"}</pre>

<p>The above will be replaced by a partial in your template. For the tag to know which template to replace, you need to pass the "name" parameter. Some parameters are required and some are optional.</p>

<h2>Tag Pairs</h2>

<p>Instead of being replaced by a single value, tags can be paired to loop through multiple values. For example:</p>

<pre class="tags">
{pyro:pages:children id="2" limit="5"}
	&lt;h1&gt;{title}&lt;/h1&gt;
	&lt;p&gt;{body}&lt;/p&gt;
{/pyro:pages:children}</pre>

<p>The above will loop through child of the page defined by the id parameter, replacing {title} and {body} with the title and body values for each entry.</p>

<h2>Tag Conditionals</h2>

<p>PyroCMS tags have the ability to perform simple conditionals, allowing you to display data based on variables in your templates.</p>

<p>Tag conditionals use the following format:</p>

<pre class="tags">{if '{pyro:lang:name}' == 'ltr'}
	{pyro:theme:js file="cufon.js"}
{/if}</pre>

<p>The above code checks the value of <em>{pyro:lang:name}</em> to see if it equals 'ltr', and displays a js file if this is true.</p>

<p>PyroCMS' conditionals also support <em>ifelse</em> and <em>else</em> conditionals:</p>

<pre class="tags">
{if '{pyro:url:segments segment="2"}' == 'blog'}
	{pyro:widgets:area slug="blog"}

{elseif '{pyro:url:segments segment="2"}' == 'home' }
	{pyro:widgets:area slug="home"}

{else}
	No widgets available.
{/if}</pre>